Stabilize cloud sync with snapshot conflict overwrite, persistent offline queue, and optimistic concurrency#1124
Draft
Copilot wants to merge 4 commits into
Draft
Stabilize cloud sync with snapshot conflict overwrite, persistent offline queue, and optimistic concurrency#1124Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
Copilot created this pull request from a session on behalf of
mikebarkmin
May 15, 2026 06:24
View session
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Member
|
@copilot Is there some to improve about the cloud sync? |
Contributor
Author
Yes — a few meaningful improvements are still possible:
If you want, I can implement (1) first as the next incremental hardening step. |
Member
|
@copilot do all three |
Contributor
Author
Implemented all three in commits
|
Copilot
AI
changed the title
Stabilize cloud sync by resolving stale-state conflicts via snapshot overwrite (no reload loop)
Stabilize cloud sync with snapshot conflict overwrite, persistent offline queue, and optimistic concurrency
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR hardens cloud synchronization so stale-state conflicts converge without reload loops, offline edits survive reload/crash, and concurrent writes are guarded with optional optimistic concurrency checks.
Changes Made
Client sync hardening (
packages/markdown/assets/cloud.js)offlineQueueinlocalStorageand reloads it on startup.stateChecksumfrom server responses for concurrency matching.offlineQueue, checksum, last event id) on auth reset/logout.Cloud API optimistic concurrency (
platforms/cloud/routes/store.js)ifMatchLastEventIdifMatchChecksumforceOverwrite(explicit override path)stateChecksumin:GET /api/store/:hyperbookIdPOST /api/store/:hyperbookId/eventsPOST /api/store/:hyperbookId/snapshot409conflict when preconditions fail, including server sync head/checksum context.Regression tests
packages/markdown/tests/cloudSync.test.js:platforms/cloud/tests/storeOptimisticConcurrency.test.js:Validation